#include "Vector.h"
#include "math.h"

Vector::Vector()
{
	x = y = 0.0f;
}

Vector::Vector(int x, int y)
{
	this->x = x;
	this->y = y;
}

Vector::Vector(Vector &other)
{
	this->x = other.x;
	this->y = other.y;
}

Vector Vector::operator +(Vector &other)
{
	Vector result;
	result.x = x + other.x;
	result.y = y + other.y;
	return result;
}

Vector Vector::operator -(Vector &other)
{
	Vector result;
	result.x = x - other.x;
	result.y = y - other.y;
	return result;
}

Vector Vector::operator *(int k)
{
	Vector result;
	result.x = x*k;
	result.y = y*k;
	return result;
}

Vector Vector::operator /(int k)
{
	Vector result;
	result.x = x/k;
	result.y = y/k;
	return result;
}

void Vector::Set(int x, int y)
{
	this->x = x;
	this->y = y;
}

void Vector::Subtract(Vector* second, Vector* result)
{
	result->x = x - second->x;
	result->y = y - second->y;
}

float Vector::Length()
{
	return sqrt((float)(x*x+y*y));
}

void Vector::Set(Vector* other)
{
	x = other->x;
	y = other->y;
}

Vector::~Vector(){}